import java.util.Scanner;
import java.util.Stack;

public class Test1 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String s=sc.nextLine();
        Stack<Integer>stack=new Stack<>();

        while(true) {
            for (int i = 0; i < s.length(); i++) {
                char a = s.charAt(i);
                int b = a - '0';
                stack.push(b);
            }
            long m = 1;

            while (!stack.empty()) {
                if (stack.peek() == 0) {
                    stack.pop();
                }
                m *= stack.pop();
            }
            System.out.println(m);
            String sa = String.valueOf(m);
            s = sa;
            long k = Long.valueOf(s);
            if (k < 10) {
                break;
            }
        }
    }
}